package com.ybu.controller;

import com.ybu.common.R;
import com.ybu.pojo.entity.District;
import com.ybu.service.DistrictService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("api/district")
public class DistrictController {
    @Autowired
    private DistrictService districtService;

    @GetMapping("getDistrict")
    public R<List<District>> getDistrictByParent(String parent){
        List<District> list = districtService.getDistrictByParent(parent);
        return R.ok(list);
    }
}
